Example usage for java.util BitSet BitSet

List of usage examples for java.util BitSet BitSet

Introduction

In this page you can find the example usage for java.util BitSet BitSet.

Prototype

private BitSet(long[] words) 

Source Link

Document

Creates a bit set using words as the internal representation.

Usage

From source file:org.apache.openjpa.kernel.StateManagerImpl.java

public BitSet getDirty() {
    if (_dirty == null) {
        _dirty = new BitSet(_meta.getFields().length);
    }
    return _dirty;
}

From source file:org.apache.openjpa.kernel.BrokerImpl.java

public boolean isCached(List<Object> oids) {
    BitSet loaded = new BitSet(oids.size());
    //check L1 cache first
    for (int i = 0; i < oids.size(); i++) {
        Object oid = oids.get(i);
        if (_cache.getById(oid, false) != null) {
            loaded.set(i);//  ww  w  .ja  v  a2s  .  com
        }
    }
    if (loaded.cardinality() == oids.size()) {
        return true;
    }
    return _store.isCached(oids, loaded);
}

From source file:org.unitime.timetable.solver.TimetableDatabaseLoader.java

public void loadRoomAvailability(RoomAvailabilityInterface availability, Date[] startEnd) {
    iProgress.setPhase("Loading room availability...", iRooms.size());
    int firstDOY = iSession.getDayOfYear(1, iSession.getPatternStartMonth());
    int lastDOY = iSession.getDayOfYear(0, iSession.getPatternEndMonth() + 1);
    int size = lastDOY - firstDOY;
    Calendar c = Calendar.getInstance(Locale.US);
    Formats.Format<Date> df = Formats.getDateFormat(Formats.Pattern.DATE_PATTERN);
    int sessionYear = iSession.getSessionStartYear();
    for (Enumeration e = iRooms.elements(); e.hasMoreElements();) {
        RoomConstraint room = (RoomConstraint) e.nextElement();
        iProgress.incProgress();/*from   w  w  w .  j  a v a2  s  .c  o m*/
        if (!room.getConstraint())
            continue;
        Collection<TimeBlock> times = getRoomAvailability(availability, room, startEnd[0], startEnd[1]);
        if (times == null)
            continue;
        for (TimeBlock time : times) {
            iProgress.debug(room.getName() + " not available due to " + time);
            int dayCode = 0;
            c.setTime(time.getStartTime());
            int m = c.get(Calendar.MONTH);
            int d = c.get(Calendar.DAY_OF_MONTH);
            if (c.get(Calendar.YEAR) < sessionYear)
                m -= (12 * (sessionYear - c.get(Calendar.YEAR)));
            if (c.get(Calendar.YEAR) > sessionYear)
                m += (12 * (c.get(Calendar.YEAR) - sessionYear));
            BitSet weekCode = new BitSet(size);
            int offset = iSession.getDayOfYear(d, m) - firstDOY;
            if (offset < 0 || offset >= size)
                continue;
            weekCode.set(offset);
            switch (c.get(Calendar.DAY_OF_WEEK)) {
            case Calendar.MONDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_MON];
                break;
            case Calendar.TUESDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_TUE];
                break;
            case Calendar.WEDNESDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_WED];
                break;
            case Calendar.THURSDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_THU];
                break;
            case Calendar.FRIDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_FRI];
                break;
            case Calendar.SATURDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_SAT];
                break;
            case Calendar.SUNDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_SUN];
                break;
            }
            int startSlot = (c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE)
                    - Constants.FIRST_SLOT_TIME_MIN) / Constants.SLOT_LENGTH_MIN;
            c.setTime(time.getEndTime());
            int endSlot = (c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE)
                    - Constants.FIRST_SLOT_TIME_MIN) / Constants.SLOT_LENGTH_MIN;
            if (endSlot == 0 && c.get(Calendar.DAY_OF_MONTH) != d)
                endSlot = 288; // next day midnight
            int length = endSlot - startSlot;
            if (length <= 0)
                continue;
            TimeLocation timeLocation = new TimeLocation(dayCode, startSlot, length, 0, 0, null,
                    df.format(time.getStartTime()), weekCode, 0);
            List<TimeLocation> timeLocations = new ArrayList<TimeLocation>(1);
            timeLocations.add(timeLocation);
            RoomLocation roomLocation = new RoomLocation(room.getResourceId(), room.getName(),
                    room.getBuildingId(), 0, room.getCapacity(), room.getPosX(), room.getPosY(),
                    room.getIgnoreTooFar(), room);
            List<RoomLocation> roomLocations = new ArrayList<RoomLocation>(1);
            roomLocations.add(roomLocation);
            Lecture lecture = new Lecture(new Long(--iFakeLectureId), null, null, time.getEventName(),
                    timeLocations, roomLocations, 1, new Placement(null, timeLocation, roomLocations), 0, 0,
                    1.0);
            lecture.setNote(time.getEventType());
            Placement p = (Placement) lecture.getInitialAssignment();
            lecture.setBestAssignment(p, 0);
            lecture.setCommitted(true);
            room.setNotAvailable(p);
            getModel().addVariable(p.variable());
        }
    }
}

From source file:io.warp10.continuum.gts.GTSHelper.java

/**
 * Shrink the internal arrays of this GTS so their length matches
 * the number of values.//  w  w w .  ja va  2s .  c o  m
 * 
 * @param gts GTS instance to shrink
 */
public static void shrink(GeoTimeSerie gts) {

    if (0 == gts.values) {
        gts.ticks = null;
        gts.locations = null;
        gts.elevations = null;
        gts.longValues = null;
        gts.doubleValues = null;
        gts.stringValues = null;
        gts.booleanValues = null;
        return;
    }

    if (null != gts.ticks && gts.ticks.length > gts.values) {
        gts.ticks = Arrays.copyOf(gts.ticks, gts.values);
    }
    if (null != gts.locations && gts.locations.length > gts.values) {
        gts.locations = Arrays.copyOf(gts.locations, gts.values);
    }
    if (null != gts.elevations && gts.elevations.length > gts.values) {
        gts.elevations = Arrays.copyOf(gts.elevations, gts.values);
    }
    switch (gts.type) {
    case UNDEFINED:
        gts.longValues = null;
        gts.doubleValues = null;
        gts.stringValues = null;
        gts.booleanValues = null;
        break;
    case LONG:
        gts.longValues = null != gts.longValues && gts.longValues.length > gts.values
                ? Arrays.copyOf(gts.longValues, gts.values)
                : gts.longValues;
        gts.doubleValues = null;
        gts.stringValues = null;
        gts.booleanValues = null;
        break;
    case DOUBLE:
        gts.longValues = null;
        gts.doubleValues = null != gts.doubleValues && gts.doubleValues.length > gts.values
                ? Arrays.copyOf(gts.doubleValues, gts.values)
                : gts.doubleValues;
        gts.stringValues = null;
        gts.booleanValues = null;
        break;
    case STRING:
        gts.longValues = null;
        gts.doubleValues = null;
        gts.stringValues = null != gts.stringValues && gts.stringValues.length > gts.values
                ? Arrays.copyOf(gts.stringValues, gts.values)
                : gts.stringValues;
        gts.booleanValues = null;
        break;
    case BOOLEAN:
        gts.longValues = null;
        gts.doubleValues = null;
        gts.stringValues = null;
        if (null != gts.booleanValues && gts.booleanValues.size() > gts.values) {
            BitSet newbits = new BitSet(gts.values);
            for (int i = 0; i < gts.values; i++) {
                newbits.set(i, gts.booleanValues.get(i));
            }
            gts.booleanValues = newbits;
        }
        break;
    }
}

From source file:org.unitime.timetable.solver.TimetableDatabaseLoader.java

public void loadInstructorAvailability(RoomAvailabilityInterface availability, Date[] startEnd) {
    iProgress.setPhase("Loading instructor availability...", getModel().getInstructorConstraints().size());
    int firstDOY = iSession.getDayOfYear(1, iSession.getPatternStartMonth());
    int lastDOY = iSession.getDayOfYear(0, iSession.getPatternEndMonth() + 1);
    int size = lastDOY - firstDOY;
    Calendar c = Calendar.getInstance(Locale.US);
    Formats.Format<Date> df = Formats.getDateFormat(Formats.Pattern.DATE_PATTERN);
    int sessionYear = iSession.getSessionStartYear();
    for (InstructorConstraint instructor : getModel().getInstructorConstraints()) {
        iProgress.incProgress();/*from www  . ja va 2 s .  c o  m*/
        Collection<TimeBlock> times = getInstructorAvailability(availability, instructor, startEnd[0],
                startEnd[1]);
        if (times == null)
            continue;
        for (TimeBlock time : times) {
            iProgress.debug(instructor.getName() + " not available due to " + time);
            int dayCode = 0;
            c.setTime(time.getStartTime());
            int m = c.get(Calendar.MONTH);
            int d = c.get(Calendar.DAY_OF_MONTH);
            if (c.get(Calendar.YEAR) < sessionYear)
                m -= (12 * (sessionYear - c.get(Calendar.YEAR)));
            if (c.get(Calendar.YEAR) > sessionYear)
                m += (12 * (c.get(Calendar.YEAR) - sessionYear));
            BitSet weekCode = new BitSet(size);
            int offset = iSession.getDayOfYear(d, m) - firstDOY;
            if (offset < 0 || offset >= size)
                continue;
            weekCode.set(offset);
            switch (c.get(Calendar.DAY_OF_WEEK)) {
            case Calendar.MONDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_MON];
                break;
            case Calendar.TUESDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_TUE];
                break;
            case Calendar.WEDNESDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_WED];
                break;
            case Calendar.THURSDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_THU];
                break;
            case Calendar.FRIDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_FRI];
                break;
            case Calendar.SATURDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_SAT];
                break;
            case Calendar.SUNDAY:
                dayCode = Constants.DAY_CODES[Constants.DAY_SUN];
                break;
            }
            int startSlot = (c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE)
                    - Constants.FIRST_SLOT_TIME_MIN) / Constants.SLOT_LENGTH_MIN;
            c.setTime(time.getEndTime());
            int endSlot = (c.get(Calendar.HOUR_OF_DAY) * 60 + c.get(Calendar.MINUTE)
                    - Constants.FIRST_SLOT_TIME_MIN) / Constants.SLOT_LENGTH_MIN;
            if (endSlot == 0 && c.get(Calendar.DAY_OF_MONTH) != d)
                endSlot = 288; // next day midnight
            int length = endSlot - startSlot;
            if (length <= 0)
                continue;
            TimeLocation timeLocation = new TimeLocation(dayCode, startSlot, length, 0, 0, null,
                    df.format(time.getStartTime()), weekCode, 0);
            List<TimeLocation> timeLocations = new ArrayList<TimeLocation>(1);
            timeLocations.add(timeLocation);
            Lecture lecture = new Lecture(new Long(--iFakeLectureId), null, null, time.getEventName(),
                    timeLocations, new ArrayList<RoomLocation>(), 0,
                    new Placement(null, timeLocation, (RoomLocation) null), 0, 0, 1.0);
            lecture.setNote(time.getEventType());
            Placement p = (Placement) lecture.getInitialAssignment();
            lecture.setBestAssignment(p, 0);
            lecture.setCommitted(true);
            instructor.setNotAvailable(p);
            getModel().addVariable(p.variable());
        }
    }
}

From source file:gov.noaa.pfel.coastwatch.Projects.java

/**
 * Get CA market catch (Short List) data into 2 nc file (Monthly and Yearly).
 *///from ww w .  j  a va2s.  co m
public static void getCAMarCatShort() throws Exception {
    String2.log("\n*** Projects.getCAMarCatShort");

    String url = "http://las.pfeg.noaa.gov/thredds/dodsC/CA_market_catch/ca_fish_grouped_short.nc";

    DConnect dConnect = new DConnect(url, true, 1, 1);
    DAS das = dConnect.getDAS(OpendapHelper.DEFAULT_TIMEOUT);
    DDS dds = dConnect.getDDS(OpendapHelper.DEFAULT_TIMEOUT);
    String name;

    //Global
    Table table = new Table();
    OpendapHelper.getAttributes(das, "GLOBAL", table.globalAttributes());

    name = "time_series";
    Attributes time_seriesAtts = new Attributes();
    OpendapHelper.getAttributes(das, name, time_seriesAtts);
    DoubleArray time_series = (DoubleArray) OpendapHelper.getPrimitiveArray(dConnect, "?" + name);
    String2.log(name + "=" + time_series);
    int nTime_series = time_series.size();

    //stations are just 1..6
    name = "stations";
    IntArray stations = (IntArray) OpendapHelper.getPrimitiveArray(dConnect, "?" + name);
    String2.log(name + "=" + stations);
    int nStations = stations.size();
    for (int s = 0; s < nStations; s++)
        Test.ensureEqual(stations.get(s), s + 1, "s+1=" + (s + 1));

    //fish are just 1..57
    name = "fish";
    IntArray fish = (IntArray) OpendapHelper.getPrimitiveArray(dConnect, "?" + name);
    String2.log(name + "=" + fish);
    int nFish = fish.size();
    Test.ensureEqual(nFish, 57, "nFish");
    for (int f = 0; f < nFish; f++)
        Test.ensureEqual(fish.get(f), f + 1, "f+1=" + (f + 1));

    //bob changed all caps to titleCase
    //bob changed groped -> grouped, littlencks -> littlenecks, speckeled -> speckled, 
    String fishnames[] = new String[] {
            //0:  18, 22, 16, 11, 16, 8, 15, 9, 11, 16, 
            "Anchovy, Northern", "Barracuda, California", "Bass, Giant Sea", "Bass, Rock", "Bonito, Pacific",
            "Cabezon", "Croaker, White", "Flounder", "Flyingfish", "Greenling, Kelp",
            //10:  11, 20, 17, 8, 15, 25, 22, 6, 9, 10,
            "Grenadiers", "Halibut, California", "Herring, Pacific", "Lingcod", "Mackerel, Jack",
            "Mackerel, Pacific (Chub)", "Mackerel, Unspecified", "Perch", "Rockfish", "Sablefish",
            //20:  7, 8, 17, 25, 6, 22, 6, 6, 5, 10,
            "Salmon", "Sanddab", "Sardine, Pacific", "Scorpionfish, California", "Shark",
            "Sheephead, California", "Skate", "Smelt", "Sole", "Swordfish",
            //30:  11, 14, 14, 15, 16, 7, 17, 17, 11, 22,
            "Thornyhead", "Tuna, Albacore", "Tuna, Bluefin", "Tuna, Skipjack", "Tuna, Yellowfin", "Turbot",
            "Whitefish, Ocean", "Whiting, Pacific", "Yellowtail", "Blackfish, Sacramento",
            //40:  5, 8, 9, 23, 11, 16, 11, 26, 6, 12,
            "Carp", "Catfish", "Hardhead", "Pikeminnow, Sacramento", "Split-tail", "Crab, Dungeness",
            "Crab, Rock", "Lobster, California Spiny", "Prawn", "Shrimp, Bay",
            //50:  22, 14, 7, 8, 6, 8, 14
            "Shrimp, Pacific Ocean", "Cucumber, Sea", "Urchin", "Abalone", "Clams", "Octopus",
            "Squid, Market" };
    Test.ensureEqual(fishnames.length, nFish, "fishnames.length");

    //fishOrder only used for documentation
    ArrayList list = new ArrayList();
    list.add(new StringArray(fishnames));
    int fishOrder[] = PrimitiveArray.rank(list, new int[] { 0 }, new boolean[] { true });
    for (int f = 0; f < nFish; f++)
        String2.log(f + " " + fishnames[fishOrder[f]]);

    String fishdescr[] = new String[] {
            //"All fish landed as anchovy EXCEPT deepbody anchovy and slough anchovyAll fish landed as barracudaAll fish landed as black seabass (1928-1960) or giant seabass (1961)Group name includes kelp bass, barred sand bass, and spotted sand bassAll fish landed as bonito or bonito tunaAll fish landed as cabezonAll fish landed as king fish or croaker or as queenfish, which was included with white croaker through 1971All fish landed as flounder or as starry flounder, but NOT arrowtooth flounder which was included with sole before 1951All fish landed as flyingfishAll fish landed as kelp greenling or as greenlingAll fish landed as grenadiers after 1971, they were part of the miscellaneous trawl category through 1971Fish landed as California halibut, possible mixing of Pacific with California halibut, see Fish Bulletin 74, p75. 1947 All fish landed as Pacific herring or as herring roe (meaning herring containing roe), not round herringAll fish landed as lingcod, called Pacific cultus before 1947.All fish landed as jack mackerel, plus proportion based on sampling of unspecified mackerel 1977-85. All fish landed as Pacific mackerel, plus proportion based on sampling of unspecified mackerel 1977-85All fish landed as mackerel from 1978-80, plus later mackerel landings if not identified by species on fish receipt or by samplingMixed species group containing just surfperches in northern Calif, but in southern Calif. also including blacksmith, halfmoon, opaleye and zebraperch - separable after 1976Mixed species group containing all species of rockfish (plus thornyheads until 1977)All fish landed as sablefish or blackcodAll fish landed as salmon including, king or chinook, silver or coho, pink, and chum - separable after 1976All fish landed as sanddabs, including Pacific, longfin and speckeledAll fish landed in California as sardine, some were mixed with mackerel schools and calculated from sampling 1981All fish landed as scorpionfish or as sculpin used as common name for scorpionfish until 1978All fish landed under various shark names separable from 1977 onAll fish landed as California sheepheadAll fish landed as skate, California skate, big skateAll fish landed as smelt, whitebait, or silversides, including topsmelt and jacksmelt.All landed as combined sole until 1954, primarily English, petrale, and rex before 1948, then Dover as well. Includes other soles and some turbot and small Calif.halibut as well. All fish landed as swordfish or broadbill swordfishIncluded as part of the rockfish catch until 1978, all fish landed as longspine, shortspine or combined thornyhead.All albacore from California watersAll bluefin tuna from California watersAll skipjack and black skipjack tuna from California waters.All yellowfin tuna from California watersAll fish landed as turbot, curlfin, diamond, C-O, and sharpridge or hornyhead.  Some included in soles before 1931.All fish landed as ocean whitefish, or whitefish.All fish landed as Pacific hake or Pacific whiting.All fish landed as yellowtail (a member of the jack family).Freshwater fish Included with hardhead until 1969, also called greaser Orthodon microlepidotus (Fish Bulletin 74, p47.).  All carp landed until 1971, some large quantities remove from Clear Lake 1931-36, Cyprinus carpio.All freshwater catfish landed, includes Forktail or channel catfish (Ictalurus catus) and and square-tail,Sacramento catfish or bullhead (Ameiurus nebulosus)All freshwater fish landed as hard head Mylopharodon conocephalus, includes blackfish in most years.All freshwater fish landed as pike Ptychocheilus grandis (not true pike) (1928-1951)All freshwater fish landed as split-tail, Pogonichtys macrolepidotus 1928-67)All crabs landed as market crab or Dungeness crab, includes some rock crabs from Santa Barbara south.All crabs landed in any of the rock crab categories (not differentiated until 1995).  All lobster called either California spiny or Pacific spiny lobster.All types of prawns landedAlmost all shrimp before 1952 were bay shrimp from SF Bay, separate category after 1951Fishery on Pacific Ocean shrimp began in 1952.California and warty sea cucumbers. Sea cucumber fishery  began 1978. All types of sea urchins but primarioy red sea urchin.All types of abalone. Just red abalone until 1943, but all were groped together until 1972. See California Living Marine Resources, p91.All types of clams, included pismo clams until 1947, also cockles or littlencks (Chione sps.)., gaper, razor, washington, jackknife, and softshell.All types of octopus.All market squid (Loligo opalescens)"
            //I add periods at end if none.
            //69, 28, 68, 70, 40, 26, 107, 119, 29, 49, 
            "All fish landed as anchovy EXCEPT deepbody anchovy and slough anchovy.",
            "All fish landed as barracuda.",
            "All fish landed as black seabass (1928-1960) or giant seabass (1961).",
            "Group name includes kelp bass, barred sand bass, and spotted sand bass.",
            "All fish landed as bonito or bonito tuna.", "All fish landed as cabezon.",
            "All fish landed as king fish or croaker or as queenfish, which was included with white croaker through 1971.",
            "All fish landed as flounder or as starry flounder, but NOT arrowtooth flounder which was included with sole before 1951.",
            "All fish landed as flyingfish.", "All fish landed as kelp greenling or as greenling.",
            //105, 119, 104, 62, 101, 102, 130, 172, 84, 40, 
            "All fish landed as grenadiers after 1971, they were part of the miscellaneous trawl category through 1971.",
            "Fish landed as California halibut, possible mixing of Pacific with California halibut, see Fish Bulletin 74, p75. 1947.",
            "All fish landed as Pacific herring or as herring roe (meaning herring containing roe), not round herring.",
            "All fish landed as lingcod, called Pacific cultus before 1947.",
            "All fish landed as jack mackerel, plus proportion based on sampling of unspecified mackerel 1977-85.",
            "All fish landed as Pacific mackerel, plus proportion based on sampling of unspecified mackerel 1977-85.",
            "All fish landed as mackerel from 1978-80, plus later mackerel landings if not identified by species on fish receipt or by sampling.",
            "Mixed species group containing just surfperches in northern Calif, but in southern Calif. also including blacksmith, halfmoon, opaleye and zebraperch - separable after 1976.",
            "Mixed species group containing all species of rockfish (plus thornyheads until 1977).",
            "All fish landed as sablefish or blackcod.",
            //107, 69, 113, 93, 64, 39, 53, 86, 179, 51,
            "All fish landed as salmon including, king or chinook, silver or coho, pink, and chum - separable after 1976.",
            "All fish landed as sanddabs, including Pacific, longfin and speckled.",
            "All fish landed in California as sardine, some were mixed with mackerel schools and calculated from sampling 1981.",
            "All fish landed as scorpionfish or as sculpin used as common name for scorpionfish until 1978.",
            "All fish landed under various shark names separable from 1977 on.",
            "All fish landed as California sheephead.",
            "All fish landed as skate, California skate, big skate.",
            "All fish landed as smelt, whitebait, or silversides, including topsmelt and jacksmelt.",
            "All landed as combined sole until 1954, primarily English, petrale, and rex before 1948, then Dover as well. Includes other soles and some turbot and small Calif. halibut as well.",
            "All fish landed as swordfish or broadbill swordfish.",
            //115, 35, 39, 60, 41, 115, 49, 51, 60, 122,
            "Included as part of the rockfish catch until 1978, all fish landed as longspine, shortspine or combined thornyhead.",
            "All albacore from California waters.", "All bluefin tuna from California waters.",
            "All skipjack and black skipjack tuna from California waters.",
            "All yellowfin tuna from California waters.",
            "All fish landed as turbot, curlfin, diamond, C-O, and sharpridge or hornyhead.  Some included in soles before 1931.",
            "All fish landed as ocean whitefish, or whitefish.",
            "All fish landed as Pacific hake or Pacific whiting.",
            "All fish landed as yellowtail (a member of the jack family).",
            "Freshwater fish Included with hardhead until 1969, also called greaser Orthodon microlepidotus (Fish Bulletin 74, p47).",
            //98, 157, 100, 84, 77, 101, 86, 68, 26, 87,
            "All carp landed until 1971, some large quantities remove from Clear Lake 1931-36, Cyprinus carpio.",
            "All freshwater catfish landed, includes Forktail or channel catfish (Ictalurus catus) and square-tail, Sacramento catfish or bullhead (Ameiurus nebulosus).",
            "All freshwater fish landed as hard head Mylopharodon conocephalus, includes blackfish in most years.",
            "All freshwater fish landed as pike Ptychocheilus grandis (not true pike) (1928-1951).",
            "All freshwater fish landed as split-tail, Pogonichtys macrolepidotus 1928-67).",
            "All crabs landed as market crab or Dungeness crab, includes some rock crabs from Santa Barbara south.",
            "All crabs landed in any of the rock crab categories (not differentiated until 1995).",
            "All lobster called either California spiny or Pacific spiny lobster.",
            "All types of prawns landed.",
            "Almost all shrimp before 1952 were bay shrimp from SF Bay, separate category after 1951.",
            //46, 70, 54, 136, 147, 21, 36
            "Fishery on Pacific Ocean shrimp began in 1952.",
            "California and warty sea cucumbers. Sea cucumber fishery  began 1978.",
            "All types of sea urchins but primarily red sea urchin.",
            "All types of abalone. Just red abalone until 1943, but all were grouped together until 1972. See California Living Marine Resources, p91.",
            "All types of clams, included pismo clams until 1947, also cockles or littlenecks (Chione spp.), gaper, razor, washington, jackknife, and softshell.",
            "All types of octopus.", "All market squid (Loligo opalescens)." };
    Test.ensureEqual(fishdescr.length, nFish, "fishdescr.size");

    StringBuilder descriptions = new StringBuilder();
    for (int f = 0; f < nFish; f++)
        descriptions.append("* " + fishnames[fishOrder[f]] + " - " + fishdescr[fishOrder[f]] + "\n");
    Attributes fishAtts = (new Attributes()).add("long_name", "Fish Name").add("description",
            descriptions.toString());

    //"San Diego    Los Angeles  Santa BarbaraMonterey     San FranciscoEureka       "
    StringArray stationnames = (StringArray) PrimitiveArray.csvFactory(String.class,
            "San Diego, Los Angeles, Santa Barbara, Monterey, San Francisco, Eureka");
    Test.ensureEqual(nStations, stationnames.size(), "nStations != nStationnames");

    name = "landings";
    Attributes landingsAtts = new Attributes();
    OpendapHelper.getAttributes(das, name, landingsAtts);
    landingsAtts.set("units", "pounds");
    IntArray landings = (IntArray) OpendapHelper.getPrimitiveArray(dConnect, "?landings.landings");
    Test.ensureEqual(landings.size(), nTime_series * nStations * nFish, "landings.size");

    //make the table  0=time 1=year 2=station 3=fish 4=landings
    DoubleArray timePA = new DoubleArray();
    ShortArray yearPA = new ShortArray();
    StringArray stationPA = new StringArray();
    StringArray fishPA = new StringArray();
    IntArray landingsPA = new IntArray();
    table.addColumn(0, "time", timePA, time_seriesAtts.add("units", Calendar2.SECONDS_SINCE_1970));
    table.addColumn(1, "year", yearPA, new Attributes());
    table.addColumn(2, "fish", fishPA, fishAtts);
    table.addColumn(3, "port", stationPA, (new Attributes()).add("long_name", "Port"));
    table.addColumn(4, "landings", landingsPA, landingsAtts);

    //add the data
    double tbf[] = Calendar2.getTimeBaseAndFactor("hours since 1900-01-01T00:00:00Z");

    for (int t = 0; t < nTime_series; t++) {
        double tt = time_series.get(t);
        double epSec = Calendar2.unitsSinceToEpochSeconds(tbf[0], tbf[1], tt);
        int tYear = String2.parseInt(Calendar2.epochSecondsToIsoStringT(epSec).substring(0, 4));

        int landingsAll[] = new int[nFish]; //0's
        for (int s = 0; s < nStations; s++) {
            int base = t * nStations * nFish + s * nFish;

            for (int f = 0; f < nFish; f++) {
                timePA.add(epSec);
                yearPA.addInt(tYear);
                fishPA.add(fishnames[f]);
                stationPA.add(stationnames.get(s));
                int tLandings = landings.get(base + f);
                landingsPA.add(tLandings);
                if (tLandings > 0)
                    landingsAll[f] += tLandings; // >0 handles mv
            }

        }

        //add the data for the All Station
        for (int f = 0; f < nFish; f++) {
            timePA.add(epSec);
            yearPA.addInt(tYear);
            fishPA.add(fishnames[f]);
            stationPA.add("All");
            landingsPA.add(landingsAll[f]);
        }
    }
    stationnames.add("All");
    nStations++;

    //sort by fish,port,time
    table.sort(new int[] { 2, 3, 0 }, new boolean[] { true, true, true });

    //save in baseDir/station/fish.nc
    String monthlyDir = "C:/u00/data/points/erdCAMarCatSM/";
    String yearlyDir = "C:/u00/data/points/erdCAMarCatSY/";
    File2.deleteAllFiles(monthlyDir, true, true); //recursive, deleteEmptySubdirectories
    File2.deleteAllFiles(yearlyDir, true, true); //recursive, deleteEmptySubdirectories
    int nRows = table.nRows();
    for (int s = 0; s < nStations; s++) {
        //make subdirectory
        String tStation = stationnames.get(s);
        String tMonthlyDir = monthlyDir + String2.encodeFileNameSafe(tStation) + "/";
        String tYearlyDir = yearlyDir + String2.encodeFileNameSafe(tStation) + "/";
        File2.makeDirectory(tMonthlyDir);
        File2.makeDirectory(tYearlyDir);
        for (int f = 0; f < nFish; f++) {
            String tFish = fishnames[f];
            String2.log(tStation + " " + tFish);
            BitSet bitset = new BitSet(nRows);
            for (int row = 0; row < nRows; row++)
                bitset.set(row, fishPA.get(row).equals(tFish) && stationPA.get(row).equals(tStation));

            //* make the monthly table  0=time 1=year 2=station 3=fish 4=landings
            DoubleArray tTimePA = (DoubleArray) timePA.clone();
            tTimePA.justKeep(bitset);
            ShortArray tYearPA = (ShortArray) yearPA.clone();
            tYearPA.justKeep(bitset);
            StringArray tStationPA = (StringArray) stationPA.clone();
            tStationPA.justKeep(bitset);
            StringArray tFishPA = (StringArray) fishPA.clone();
            tFishPA.justKeep(bitset);
            IntArray tLandingsPA = (IntArray) landingsPA.clone();
            tLandingsPA.justKeep(bitset);
            Table tTable = new Table();
            tTable.addColumn(0, "time", tTimePA, (Attributes) table.columnAttributes(0).clone());
            tTable.addColumn(1, "year", tYearPA, (Attributes) table.columnAttributes(1).clone());
            tTable.addColumn(2, "fish", tFishPA, (Attributes) table.columnAttributes(2).clone());
            tTable.addColumn(3, "port", tStationPA, (Attributes) table.columnAttributes(3).clone());
            tTable.addColumn(4, "landings", tLandingsPA, (Attributes) table.columnAttributes(4).clone());

            //save the monthly file
            tTable.saveAsFlatNc(tMonthlyDir + String2.encodeFileNameSafe(tFish) + ".nc", "row", false);

            //* condense to yearly data
            int readRow = 0, writeRow = 0, tnRows = tTable.nRows();
            while (readRow < tnRows) {
                short tYear = tYearPA.get(readRow);
                int sum = tLandingsPA.get(readRow);
                int nextRow = readRow + 1;
                while (nextRow < nRows && tYear == yearPA.get(nextRow)) {
                    sum += tLandingsPA.get(nextRow);
                    nextRow++;
                }
                //store the data on writeRow;  change time to be tYear-07-01
                tTimePA.set(writeRow, Calendar2.isoStringToEpochSeconds(tYear + "-07-01"));
                tYearPA.set(writeRow, tYear);
                tStationPA.set(writeRow, tStation);
                tFishPA.set(writeRow, tFish);
                tLandingsPA.set(writeRow, sum);
                writeRow++;

                readRow = nextRow;
            }
            tTable.removeRows(writeRow, tnRows);

            //save the yearly file
            tTable.saveAsFlatNc(tYearlyDir + String2.encodeFileNameSafe(tFish) + ".nc", "row", false);
        }
    }

    String2.log("\n*** Projects.getCAMarCatShort successfully created");

}

From source file:com.nfsdb.thrift.model.Trade2.java

private void readObject(java.io.ObjectInputStream in) throws java.io.IOException {
    try {//from  w w  w . ja v  a2 s . co m
        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
        __isset_bit_vector = new BitSet(1);
        read(new org.apache.thrift.protocol.TCompactProtocol(
                new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
    }
}

From source file:gov.noaa.pfel.erddap.dataset.EDDTableFromNcFiles.java

/** one time(?) test for Bob */
public static void bobFindGtsppDuplicateCruises() throws Throwable {
    EDDTable eddTable = (EDDTable) oneFromDatasetsXml(null, "testErdGtsppBest");
    eddTable.makeNewFileForDapQuery(null, null,
            "cruise,type,org,platform&orderBy(\"cruise,type,org,platform\")&distinct()", "/temp/",
            "gtsppDuplicates", ".nc");
    Table table = new Table();
    table.readFlatNc("/temp/gtsppDuplicates.nc", null, 0);
    int n = table.nRows();
    BitSet keep = new BitSet(n); //all false
    PrimitiveArray cr = table.getColumn(0);
    PrimitiveArray ty = table.getColumn(1);
    PrimitiveArray or = table.getColumn(2);
    String2.log("nRows=" + n);
    for (int row = 1; row < n; row++) { //look back
        if (cr.getString(row - 1).equals(cr.getString(row)) && ty.getString(row - 1).equals(ty.getString(row))
                && or.getString(row - 1).equals(or.getString(row))) {
            keep.set(row - 1);//from  w  w w .j a  v a  2  s  .  c o  m
            keep.set(row);
        }
    }
    table.justKeep(keep);
    String2.log("nRows=" + table.nRows());
    String2.log(table.toString());
}

From source file:gov.noaa.pfel.coastwatch.Projects.java

/**
 * Get CA market catch (Long List) data into 2 nc file (Monthly and Yearly).
 *//*from  ww  w. ja v a  2 s  . co m*/
public static void getCAMarCatLong() throws Exception {
    String2.log("\n*** Projects.getCAMarCatLong");

    String url = "http://las.pfeg.noaa.gov/thredds/dodsC/CA_market_catch/ca_fish_grouped.nc";

    DConnect dConnect = new DConnect(url, true, 1, 1);
    DAS das = dConnect.getDAS(OpendapHelper.DEFAULT_TIMEOUT);
    DDS dds = dConnect.getDDS(OpendapHelper.DEFAULT_TIMEOUT);
    String name;

    //Global
    Table table = new Table();
    OpendapHelper.getAttributes(das, "GLOBAL", table.globalAttributes());

    name = "time_series";
    Attributes time_seriesAtts = new Attributes();
    OpendapHelper.getAttributes(das, name, time_seriesAtts);
    DoubleArray time_series = (DoubleArray) OpendapHelper.getPrimitiveArray(dConnect, "?" + name);
    String2.log(name + "=" + time_series);
    int nTime_series = time_series.size();

    //stations are just 1..6
    name = "stations";
    IntArray stations = (IntArray) OpendapHelper.getPrimitiveArray(dConnect, "?" + name);
    String2.log(name + "=" + stations);
    int nStations = stations.size();
    for (int s = 0; s < nStations; s++)
        Test.ensureEqual(stations.get(s), s + 1, "s+1=" + (s + 1));

    //fish are just 1..
    name = "fish";
    IntArray fish = (IntArray) OpendapHelper.getPrimitiveArray(dConnect, "?" + name);
    String2.log(name + "=" + fish);
    int nFish = fish.size();
    Test.ensureEqual(nFish, 341, "nFish");
    for (int f = 0; f < nFish; f++)
        Test.ensureEqual(fish.get(f), f + 1, "f+1=" + (f + 1));

    //fish name nchar
    name = "nchar";
    IntArray nchar = (IntArray) OpendapHelper.getPrimitiveArray(dConnect, "?" + name);
    String2.log(name + "=" + nchar);
    Test.ensureEqual(nchar.size(), nFish, "nchar.length");

    //fishnames
    String fishNamesString = "ANCHOVY, NORTHERNANCHOVY, DEEPBODYBARRACUDA, CALIFORNIABASS, BARRED SAND BASS, GIANT SEA BASS, KELP BASS, ROCK BASS, SPOTTED SAND BASS, STRIPED BLACKSMITHBONEFISH BONITO, PACIFIC BUTTERFISH, PACIFIC CABEZON CABRILLA, SPOTTEDCOD, PACIFIC CORBINA, CALIFORNIA CORVINA, SHORTFIN CROAKER, BLACK CROAKER, VARIOUS SPECIES CROAKER, WHITE CROAKER, YELLOWFIN CUSK-EEL, SPOTTED DOLPHINFISH EEL EEL, BLENNY EEL, CALIFORNIA MORAY ESCOLAR EULACHON FLOUNDER, ARROWTOOTH FLOUNDER, STARRY FLOUNDER, UNCLASSIFIED FLYINGFISH GARIBALDI GOBY, BLUEBANDED GOBY, YELLOWFIN GREENLING, KELP GRENADIERS GROUPER GROUPER, BROOMTAIL GRUNION, CALIFORNIA GUITARFISH, SHOVELNOSE HAGFISH HALFMOON HALIBUT, CALIFORNIA HALIBUT, PACIFICHALIBUT, UNSPECIFIEDHERRING ROE ON KELP HERRING, PACIFIC HERRING, WHOLE FISH WITH ROE HERRING, ROUND JACK CREVALLE JACKS KAHAWAI KELPFISHES KILLIFISH, CALIFORN LINGCOD LIZARDFISH, CALIFORNIA LOUVAR MACKEREL, BULLET MACKEREL, JACK MACKEREL, PACIFIC MACKEREL, UNSPECIFIED MARLIN, STRIPED MIDSHIPMAN, PLAINFIN MOLA, COMMON MONKEYFACE EEL MUDSUCKER, LONGJAW MULLET, STRIPED NEEDLEFISH, CALIFORNIA OILFISH OPAH OPALEYE PERCH PERCH, PACIFIC OCEAN POMFRET, PACIFICQUEENFISH RATFISH RAY, BAT RAY, PACIFIC ELECTRIC RAY ROCKFISH, AURORA ROCKFISH, BANK ROCKFISH, BLACKGILL ROCKFISH, BLACK-AND-YELLOW ROCKFISH, BLACK ROCKFISH, BLUE ROCKFISH, BOCACCIO ROCKFISH, BRONZESPOTTED ROCKFISH, BROWN ROCKFISH, CALICO ROCKFISH, NOMINAL CANARY ROCKFISH, CHAMELEON ROCKFISH, CHILIPEPPER ROCKFISH, CHINA ROCKFISH, COPPER ROCKFISH, COWCOD ROCKFISH, DARKBLOTCHED ROCKFISH, FLAG ROCKFISH, GROUP BLUE/BLACK ROCKFISH, GROUP BOCACCIO/CHILIRROCKFISH, GROUP BOLINA ROCKFISH, GROUP CANARY/VERMILLROCKROCKFISH, GROUP DEEP RED ROCKFISH, GROUP GOPHER ROCKFISH, GROUP RED ROCKFISH, GROUP ROSEFISH ROCKFISH, GROUP SMALL RED ROCKFISH, GOPHER ROCKFISH, GRASS ROCKFISH, GREENBLOTCHED ROCKFISH, GREENSTRIPED ROCKFISH, GREENSPOTTED ROCKFISH, HONEYCOMB ROCKFISH, KELP ROCKFISH, MEXICAN ROCKFISH, OLIVE ROCKFISH, PINK ROCKFISH, PINKROSE ROCKFISH, QUILLBACK ROCKFISH, REDBANDED ROCKFISH, ROSETHORN ROCKFISH, ROSY ROCKFISH, SHORTBELLY ROCKFISH, SPLITNOSE ROCKFISH, SPECKLED ROCKFISH, SQUARESPOT ROCKFISH, STRIPETAIL ROCKFISH, STARRY ROCKFISH, SWORDSPINE ROCKFISH, TREEFISH ROCKFISH,UNSPECIFIED ROCKFISH,UNSPECIFIED NEARSHORERROCKFISH,UNSPECIFIED SHELF ROCKFISH,UNSPECIFIED SLOPE ROCKFISH, VERMILLION ROCKFISH, WIDOW ROCKFISH, YELLOWEYE ROCKFISH, YELLOWTAIL SABLEFISH SAILFISH SALEMA SALMON SALMON, CHUM SALMON, KING SALMON ROE, KING SALMON, PINK SALMON, SILVER SANDDAB SANDDAB, LONGFIN SANDDAB, PACIFIC SANDDAB, SPECKLED SARDINE, PACIFIC SARGO SAURY, PACIFIC SCORPIONFISH, CALIFORNIA  SCULPIN, PACIFIC STAGHORN SCULPIN, YELLOWCHIN SEABASS, WHITE SENORITA SHAD, AMERICAN SHAD, THREADFIN SHARK SHARK, PACIFIC ANGEL SHARK, BLUE SHARK, BONITO (MAKO) SHARK, BROWN SMOOTH SHARK, BASKING SHARK, BLACK TIP SHARK, COMMON THRESHER SHARK, COW SHARK, SPINY DOGFISH SHARK, DUSKY SHARK, SMOOTH HAMMERHEAD SHARK, HORN SHARK, LEOPARD SHARK, SALMON SHARK, SEVENGILL SHARK, SIXGILL SHARK, GRAY SMOOTHHOUND SHARK, SOUPFIN SHARK, SWELL SHARK, BIGEYE THRESHER SHARK, PELAGIC THRESHER SHARK, WHITE SHEEPHEAD, CALIFORNIA SIERRA SKATE SKATE, BIG SKATE, CALIFORNIA SKATE, THORNY SMELT SMELT, ATHERINID SMELT, JACKSMELT SMELT, NIGHT SMELT, SURF SMELT, TOPSMELT SMELT, TRUE SMELT, WHITEBAIT SNAPPER -MEXICO- SOLE, BIGMOUTH SOLE, BUTTER SOLE, C-O SOLE, CURLFIN SOLE, DOVER SOLE, ENGLISH SOLE, FANTAIL SOLE, PETRALE SOLE, ROCK SOLE, REX SOLE, SAND SOLE, SLENDER SOLE, UNCLASSIFIED SURFPERCH SURFPERCH, BARRED SURFPERCH, BLACK SURFPERCH, CALICO SURFPERCH, DWARF SURFPERCH, PILE SURFPERCH, PINK SURFPERCH, RAINBOW SURFPERCH, REDTAIL SURFPERCH, RUBBERLIP SURFPERCH, SHINER SURFPERCH, WALLEYE SURFPERCH, WHITE STICKLEBACK, THREESPINE STINGRAY STURGEON SWORDFISH THORNYHEAD THORNYHEAD, LONGSPINE THORNYHEAD, SHORTSPINE TOMCOD, PACIFIC TRIGGERFISH TONGUEFISH, CALIFORNIA  TUNA, ALBACORE TUNA, BIGEYE TUNA, BLACKFIN TUNA, BLUEFIN TUNA, SKIPJACK TUNA, SKIPJACK, BLACK TUNA, YELLOWFIN TUNA, UNSPECIFIED TURBOT, DIAMOND TURBOT, HORNYHEAD TURBOT, SPOTTED TURBOT, UNSPECIFIED WAHOO WHITEFISH, OCEAN WHITING, PACIFIC WOLF-EEL WRASSE, ROCK YELLOWTAIL ZEBRAPERCH UNSPECIFIED TRAWLED FISH UNSPECIFIED FISH BLACKFISH, SACRAMENTO CARP CATFISH HARDHEAD HITCH PIKEMINNOW, SACRAMENTO SPLIT-TAIL SUCKER, WESTERN BARNACLE BOX CRAB CRAB, CLAWS CRAB, DUNGENESS CRAB, KING CRAB, PELAGIC RED CRAB, ROCK CRAB, BROWN ROCK CRAB, RED ROCK CRAB, YELLOW ROCK CRAB, SAND CRAB, SHORE CRAB, SPIDER CRAB, TANNER CRAYFISH LOBSTER, CALIFORNIA SPINY PRAWN, GOLDEN PRAWN, RIDGEBACK PRAWN, SPOTTED PRAWN, UNSPECIFIED SHRIMP, BAY SHRIMP, BRINE SHRIMP, COONSTRIPE SHRIMP, GHOST SHRIMP, PACIFIC OCEAN SHRIMP, RED ROCK SHRIMP, UNSPECIFIED CRUSTACEAN, UNSPECIFIED CUCUMBER, SEA ECHINOD, UNSPECIFIED SEA STARS URCHIN, LYTECHINUS URCHIN, PURPLE SEA URCHIN, RED SEA URCHIN, UNSPECIFIED ABALONE, BLACK ABALONE, FLAT ABALONE, GREEN ABALONE, PINK ABALONE, WHITE ABALONE, THREADED ABALONE, PINTO ABALONE, RED ABALONE, UNSPECIFIED CHITON CLAM, GAPER CLAM, CALIFORNIA JACKKNIFE CLAM, NATIVE LITTLENECK CLAM, NOTHERN RAZOR CLAM, PURPLE CLAM, PISMO CLAM, ROSY RAZOR CLAM, SOFT SHELLED CLAM, COMMON WASHINGTON CLAM, UNSPECIFIED LIMPET, UNSPECIFIED MOLLUSK, UNSPECIFIED MUSSEL OCTOPUS, UNSPECIFIED OYSTER, CALIFORNIA OYSTER, EASTERN OYSTER, EUROPEAN FLAT OYSTER, GIANT PACIFIC OYSTER, UNSPECIFIED SCALLOP, UNSPECIFIED SEA HARES SEA SLUG SNAIL, SEA SQUID, JUMBO SQUID, MARKET WHELK FROGS INVERTEBRATES, COLONIAL WORMS, MARINE TURTLES, FRESHWATER TURTLES, MARINE ";
    String fishnames[] = new String[nFish];
    int po = 0;
    for (int f = 0; f < nFish; f++) {
        fishnames[f] = String2.toTitleCase(fishNamesString.substring(po, po + nchar.get(f)).trim());
        if (fishnames[f].equals("Killifish, Californ"))
            fishnames[f] = "Killifish, California";
        fishnames[f] = String2.replaceAll(fishnames[f], "Rockfish,Un", "Rockfish, Un");
        if (fishnames[f].indexOf("Littlencks") >= 0 || fishnames[f].indexOf("Speckeled") >= 0
                || fishnames[f].indexOf("Groped") >= 0) {
            String2.log("trouble: #" + f + "=" + fishnames[f]);
        }
        String2.log(f + " " + fishnames[f]);
        po += nchar.get(f);
    }

    //String2.toTitleCase()
    Test.ensureEqual(fishnames.length, nFish, "fishnames.length");

    //fishOrder only used for documentation
    ArrayList list = new ArrayList();
    list.add(new StringArray(fishnames));
    int fishOrder[] = PrimitiveArray.rank(list, new int[] { 0 }, new boolean[] { true });
    //for (int f = 0; f < nFish; f++)
    //    String2.log(f + " " + fishnames[fishOrder[f]]);

    //fish description ndescr
    name = "ndescr";
    IntArray ndescr = (IntArray) OpendapHelper.getPrimitiveArray(dConnect, "?" + name);
    String2.log(name + "=" + ndescr);
    Test.ensureEqual(ndescr.size(), nFish, "ndescr.length");

    //fishnames
    String fishDescrString = "Norhtern anchovy (Engraulis mordax) all anchovy landed EXCEPT deepbody anchovy, all yearsDeepbody anchovy (Anchoa compressa) mostly in bays and estuaries, 1978+California barracuda (Sphyraena argentea) all yearsBarred sand bass (Paralabrax nebulifer) 1978+, included in BASS, ROCK category before 1978Giant or black sea bass (Sterolepis gigas) all years Kelp bass (Paralabrax clathratus) 1978+, included in BASS, ROCK category before 1978Group name includes kelp bass, barred sand bass, and spotted sand bass, 1928-53 then sport only after 1953, some years 1978+Spotted sand bass (Paralabrax maculatofasciatus), small component of BASS, ROCK category before 1978Striped bass (Roccus saxatilis), Sport only after 1935Blacksmith (Chromis punctipinnis) included in Perch category before 1963Bonefisn (Albula vulpes), 1983 onlyPacific Bonito or bonito tuna (Sarda chiliensis) all yearsPacific butterfish also called California pompano  (Peprilus simillimus) all yearsCabezon (Scorpaenichthys marmoratus) all years ,,,,\"Spotted Cabrilla (Epinephelus analogus) a sea bass, 1930, 1983+1977+ Pacific cod (Gadus macrocephalus) 1977+California corbina (Menticirrhus undulatus), a croaker 1981+(1928-41, 1995+)Shortfin corvina or shortfin seabass (Cynoscion parvipinnis), a croaker caught and sometimes landed mixed with white croakers 1932-41 and 1995+Black croaker (Cheilotrema saturnum) 1979+ Croakers of various unidentified species 1978+, probably inclded in CROAKER, WHITE before 1978White croaker also called kingfish (Genyonemus lineatus) may include other croakers especially queenfish (Seriphus politus)Yellowfin croaker (Umbrina roncador) 1995+Spotted cusk-eel (Chilara taylori) 1994+Dolfpninfish (Coryphaena hippururs), Fish NOT Mammals, occasional 1930-62, yearly 1972+Various unspecified eels including moray, wolfeel, blennies and pricklebacks.Blennies, unidentified, 1931 only, probably pricklebacksCalifornia Moray (Gymnothorax mordax) 1931-32, 1981+ Escolar (Lepidocybium flavobrunneum) 1994+Eulachon (Thaleichthys pacificus) 1987+Arrowtooth flounder (Atheresthes stomias) 1955+, included with sole before 1951Starry flounder (Platichthys stellatus), in unclassified flounder some years or ports, combine with FLOUNDER, UNCLASSIFIED 1930-46 and 1978+Flounders, almost entirely starry flounder (Platichthys stellatus), combine with FLOUNDER, STARRY.  most yearsProbably mostly California Flyingfish (Cypselurus californicus), all yearsGaribaldi (Hypsypops rubicundus), Not a commercial species, small amounts 1979+Bluebanded goby, (Lythrypnus dalli) 1985+Yellowfin goby (Acanthogobius flavimanus), 1990+Kelp greenling (Hexagrammos decagrammus)  most yearsVarious grenadiers, Pacific grenadier (Coryaphaenoides acrolepis) and giant grenadier (Albatrossia pectoralis) and possibly others, 1972+Various species of grouper (Mycteroperca)  1931, 1978+Broomtail grouper (Mycteroperca xenarcha) 1985+California Grunion (Leuresthes tenuis), not a commercial species, some 1978+Shovelnose guitarfish (Rhinobatos productus), 1977+Hagfish (Eptatretus spp.) 1983+Halfmoon (Medialuna californicus), included in Perch category before 1954California halibut (Paralicthys californicus), may include some Pacific halibut landings, all yearsPacific halibut (Hippoglossus stenolepis), some landings may have been recorded as California halibut, most yearsUnspecified halibut, may be either California halibut (Paralicthys californicus), or Pacific halibut (Hippoglossus stenolepis) in Northern California 1978+Pacific herring roe laid on kelp, 1987+Pacific herring (Clupea pallasi) all years, combine with HERRING, WHOLE FISH WITH ROEPacific herring (Clupea pallasi) containing roe, 1993+, combine with HERRING, PACIFIC Round herring (Etrumeus teres), may be some mislabled Pacific herring included 1962, 1985, 1992+Crevalle jack (Caranx hippos), 1992+Various species of jacks, family Carangidae 1992+Kahawai or Australian Salmon (Arripis spp), 1989 + 1999Giant kelpfish (Heterostichus robustus) and other kelpfishes 1979+California killifish (Funduous parvipinnis) 1993Lingcod (Ophiodon elongatus) called Pacific cultus before 1946,  all yearsCalifornia lizardfish (Synodus lucioceps) 1980+Louvar (Luvarus imperialis) 1984+Bullet mackerel (Auxis fochei) 1976+Jack mackerel (Trachurus symmetricus) a jack, called Horse mackerel before 1945, see unspecified mackerel 1977-85. Pacific mackerel (Scomber japonicus), see unspecified mackerel 1977-85.Mixture of jack mackerel and Pacific mackerel landed as mixed mackerel 1977+, for breakdown see Californias Living Marine Resources, p312-313.Striped marlin (Tetrapturus audax), not commercial after 1938Plainfin midshipman (Porichthys notatus) 1954, 1983+Mola or Ocean sunfish (Mola mola) 1982+Monkyface-eel or monkeyface prickleback (Cebidichthys violaceus) 1981+Longjaw mudsucker (Gilllichthys mirabilis) used for bait, 1971+Mullet (Mugil cephalus), some landings are from the Salton Sea in 1940s.Needlefish (Strongylura exilis) 1954+Oilfish (Ruvettus pretiosus) 1996+Opah (Lampris regius) 1976+Opaleye (Girella nigricans) included in perch category before 1954Market category includes surfperch in northern Calif. and other perch-like species in Soutnern Calif. included opaleye, halfmoon and sargo until 1954, blacksmith until 1962.  see Fish Bulletin 149 table 17Rockfish landed as market category Pacific Ocean Perch (Sebastes alutus) 1977+, species identification required 1984+Fish landed as Pacific Pomfret (Brama japonica)Queenfish (Seraphus politus) a croaker, included with white croaker before 1972.Ratfish (Hydrolagus colliei), occasional yearsBat ray (Myliobatis californica) 1977+, may be included with skates in earlier years.Pacific electric ray, (Torpedo californica) 1977+Rays not identified to species 1977+Rockfish landed as market category aurora (Sebastes aurora) may include other species, 1993+Rockfish landed as market category bank (Sebastes rufus) may include other species, 1980+Rockfish landed as market category blackgill (Sebastes melanostomus)  may include other species, 1980+Rockfish landed as market category black-and-yellow (Sebastes chrysomelas)  may include other species, 1979+Rockfish landed as market category black (Sebastes melanops)  may include other species, 1977+Rockfish landed as market category blue (Sebastes mystinus)  may include other species, 1977+Bocaccio rockfish (Sebastes paucispinus),1977+, species identification required from 1991+Rockfish landed as market category bronzespotted (Sebastes gilli)  may include other species, 1991+Rockfish landed as market category brown includes widow (Sebastes entomelas) and copper (S. caurinus) as well as brown (S. auriculatus) 1977+.  Also see BolinaRockfish landed as market category calico (Sebastes dallii)  may include other species. Rockfish landed as market category canary (Sebastes pinniger) may include other species before 1998, Canary Rockfish also in ROCKFISH, GROUP CANARY/VERMILLION 1994+Rockfish landed as market category chameleon (Sebastes phillipsi) may include other species, 1985+Rockfish landed as market category chilipepper (Sebastes goodei) may include other species, 1979+Rockfish landed as market category china (Sebastes nebulosa) may include other species, 1979+Rockfish landed as market categories copper (Sebastes caurinus) and whitebelly (S. vexillarius) may include other species, 1977+Rockfish landed as market category cowcod (Sebastes levis)  may include other species, 1979+Rockfish landed as market category darkblotched (Sebastes crameri) may include other species, 1996+Rockfish landed as market category flag (Sebastes rubrivinctus) may include other species, 1979+Rockfish landed as market category blue/black includes (Sebastes mystinus and S. melanops) may include other species, 1994+Rockfish landed as market category bocaccio/chillipepper (Sebastes paucispinis and S. goodei) may include other species 1980-93Rockfish landed as market category bolina includes brown (Sebastes auriculatus), copper (S. caurinus) and other species 1980+Rockfish landed as market category canary/vermillion 1994+.   may include other species.  See also ROCKFISH, NOMINAL CANARY and ROCKFISH, VERMILLION.Rockfish landed as market category deep reds may include various species of rockfish 1982+Rockfish landed as market category gopher group includes gopher (Sebastes carnatus) and other species 1985+, see also ROCKFISH, GOPHERRockfish landed as market category group red may include various species of rockfish 1980+Rockfish landed as market category group rosefish, primarily splitnose (Sebastes diploproa) and aurora (S. aurora) 1982+Rockfish landed as market category group smallred may include various species of small rockfish 1980+Rockfish landed as market category gopher may contain black-and-yellow (Sebastes chrysomelas), kelp (S. atrovirens) and others as well as gopher (Sebastes carnatus) 1979+Rockfish landed as market category grass (Sebastes rastrelliger)  may include other species, 1979+Rockfish landed as market category greenblotched (Sebastes rosenblatti) may include other species, 1990+Rockfish landed as market category greenstriped (Sebastes elongatus) may include other species, 1978+Rockfish landed as market category greenspotted (Sebastes chlorostictus)probably single species, 1979+Rockfish landed as market category honeycomb (Sebastes umbrosus) may include other species, 1993Rockfish landed as market category kelp rockfish (Sebastes atrovirens) may include other species, 1980+ see ROCKFISH, GOPHERRockfish landed as market category Mexican Rockfish 2002+Rockfish landed as market category olive (Sebastes serranoides) may include other species, 1979+Rockfish landed as market category pink (Sebastes eos) may include other species, 1987+Rockfish landed as market category pinkrose (Sebastes simulator) may include other species, 1987+Rockfish landed as market category quillback (Sebastes maliger) may include other species, 1994+Rockfish landed as market category redbanded (Sebastes nigrocinctus) may include other species, 1989+Rockfish landed as market category rosethorn (Sebastes helvomaculatus) may include other small species, 1991+Rockfish landed as market category rosy (Sebastes rosaceus) may include other small species, 1979+Rockfish landed as market category shortbelly (Sebastes jordani) may include other species, 1979+Rockfish landed as market category splitnose (Sebastes diploproa) may include other species,1977+Rockfish landed as market category speckled (Sebastes ovalis) may include other species,1979+Rockfish landed as market category squarespot (Sebastes hopkinsi) may include other species,1994+Rockfish landed as market category stripetail (Sebastes saxicola) may include other speciesRockfish landed as market category starry (Sebastes constellatus) may include other species,1977+Rockfish landed as market category swordspine (Sebastes ensifer) may include other small species,1996+Rockfish landed as market category treefish (Sebastes serriceps) may include other species,1980+Rockfish landed as market category unspecified rockfish, includes various species,1928+Rockfish landed as market category unspecified rockfish nearshore, from 2000Rockfish landed as market category unspecified rockfish shelf, from 2000Rockfish landed as market category unspecified rockfish slope, from 2000Rockfish landed as market category vermillion (Sebastes miniatus) may include other species,1977+, see also ROCKFISH, GROUP CANARY/VERMILLION,1977+Widow rockfish (Sebastes entomelas),1977+, identification required from 1983+Rockfish landed as market category yelloweye (Sebastes ruberrimus) may include other species,1977+Yellowtail rockfish (Sebastes flavidus) identification required from 1994+Sablefish or blackcod (Anoplopoma fimbria) all yearsSailfish (Istiophorus platypterus) 1982 onlySalema (Xenistius californiensis) 1971 and 1992 onlyAll species of salmon were recorded together before 1977, some unspecified landings 1978-85.Chum salmon (Oncorhycus keta) 1977+, see  before 1977King or chinook salmon (Oncorhycus tshawytscha) 1977+, see  before 1977The roe from king or chinook salmon. 1994+Pink salmon (Oncorhycus gorbuscha)  1977+, see  before 1977Silver or coho salmon (Oncorhycus kisutch) 1977+,  see  before 1977All species of sanddabs before 1990, and most of sanddab landings after 1990Longfin sanddab, (Citharichthys xanthostigma) 1999+Pacific sanddab (Citharichthys sordidus) 1990+Speckled sanddab (Citharichthys stigmaeus) 1997+Pacific sardine also called Pacific pilchard (Sardinops sagax) all years Sargo (Anisotremus davidsonii),1954+, included in perch category until 1953.Pacific saury (Cololabis saria) occasional landings.Spotted scorpionfish commonly called sculpin (Scorpeaena guttata), all yearsPacific staghorn sculpin (Leptocottus armatus) 1935, 1950s, 1978+Yellowchin sculpin (Icelinus quadriseriatus) 1994White seabass (Atractoscion noblis), all years Seniorita (Oxyjulis californica) 1973, 1994+American shad (Alosa sapidissima) Sactamento River delta fishery 1928-51, small amounts from 1986+Threadfin shad, (Dorosoma petenense) San Francisco Bay, 1987+ All shark landings until 1976, unspecified sharks, 1977+Pacific angel shark (Squatina californica), 1977+Blue shark (Prionace glauca), 1977+Bonito or short fin mako shark (Isurus oxyrinchus), 1977+Brown smoothound shark (Mustelus henlei), 1977+Basking shark (Cetorhinus maximus), 1991+Black tip shark presumably (Carcharhinus limbatus), 1984, 1993, 1999Common thresher shark (Alopias vulpinus), 1977+Cow sharks group sixgill (Hexanchus griseus) and sevengill (Notorynchus maculatus), see also Sevengill shark, 1977+Spiny dogfish (Squalus acanthias), 1977+Dusky shark (Carcharhinus obscurus), 1977+Smooth hammerhead shark (Sphyrna zygaena), 1977+Horn shark (Heterodontus francisci), 1977+Leopard shark (Triakis semifasciata), 1977+Salmon shark (Lamna ditropsis), 1977+Sevengill shark (Notorynchus maculatus) see also Cow shark, 1977+Sixgill shark (Hexanchus griseus) see also Cow sharks,1979+ Gray smoothound shark (Mustelus californicus), 1977+Soupfin shark (Galeorhinus zyopterus), in general shark category prior to 1977 include high landings 1936-44 for vitamin A in livers, separate category 1928-29, 1977+Swell shark (Cephaloscyllium ventriosum), 1978+Big eye thresher shark (Alopias superciliosus), 1980+Pelagic thresher shark (Alopias pelagicus) sometimes confused with common thresher shark (Alopias vulpinus), 1977+White shark (Carcharodon carcharias), 1979+California Sheephead (Semicossyphus pulcher), all yearsSierra (Scomberomorus sierra), 1987 onlySkates unspecified, may include rays also, all yearsBig skate (Raja binoculata), 1983+California skate (Raja inornata), 1978+Thorny skate, probably Thornback (Platyrhinoidis triseriata)Included all silversides and all smelts except those landed as whitebait until 1976, dominated by jacksmelt.Group called silversides, includes Jacksmelt (Atherinopsis californiensis) and Topsmelt (Atherinops affinis) 1978+, overlaps with individual species landingsJacksmelt (Atherinopsis californiensis) a silverside 1986+ Majority in Smelt before 1977, in SMELT, ATHERINID 1976-85+Night smelt (Spirinchus starski), may include surf smelt as well 1976+, see also SMELT, TRUESurf smelt (Hypomesus pretiosus) may include night smelt as well 1976+, see also SMELT, TRUETopsmelt (Atherinops affinis) a silverside. 1986+ Included in Smelt before 1977, in SMELT, ATHERINID 1976-85+Combined market categoty of surf smelt (Hypomesus pretiosus) and Night smelt (Spirinchus starski) 1976+,  overlaps with individual species landingsCombined market categoty of Whitebait smelt (Allosmerus elongatus) plus Night smelt (Spirinchus starski)  F&G Fish Bulletin 74 p142Unknwn species landed as snapper, 1994 onlyBig mouth sole (Hippoglossina stomata), 1979+Butter sole (Inopsetta isolepis), 1977+C-O sole or C-O turbot (Pleuronichthys coenosus) Curfin sole or curfin turbot (Pleuronichthys decurrens), 1994+.  May have been in either sole or turbot before 1994.Dover sole (Microstomus pacificus) included with sole unspecified 1948-1954.English sole (Parophrys vetulus) dominated the sole unspecified category before 1955.  See F&G Bulletin 149, p65.Fantail sole (Xystreurys liolepis), 1977+Petrale sole (Eopsetta jordani) 1954+, about 20% of sole unspecified before 1950.  See F&G Bulletin 149, p65.Rock sole (Lepidopsetta bilineata), 1977+Rex sole (Glyptocephalus zachirus) 1954+, less than 10% of unspecified soles before 1954.  See F&G Bulletin 149, p65.Sand sole (Psettichthys melanostictus), 1954+Slender sole (Lyopsetta exilis), 1979+All soles, dominated by English sole through 1948. Dover sole dominant 1949-53. Only unspecified soles after 1954.  See F&G Bulletin 149, p65. Unclassified surfperch 1977+.  Included in perch category before 1977.Barred surfperch (Amphistichus argenteus) 1977+.  Included in perch category before 1977.Black surfperch (Embiotoca jacksoni) 1977+.  Included in perch category before 1977 Calico surfperch (Amphistichus koelzi) 1980+.  Included in perch category before 1977 Dwarf surfperch (Micrometrus minimus) 1983, 1996.  Included in perch category before 1977Pile surfperch (Damalicthys vacca) 1979+.  Included in perch category before 1977Pink surfperch (Zalembius rosaceus) Rainbow surfperch (Hypsurus caryi) 1980+.  Included in perch category before 1977Redtail Surfperch (Amphistichus rhodoterus), 1979+.  Included in perch category before 1977Rubberlip surfperch (Rhacochilus toxotes), 1979+.  Included in perch category before 1977Shiner surfperch (Cymatogaster aggregata) 1979+.  Included in perch category before 1977Walleye surfperch (Hyperprosopon argenteum) 1977+.  Included in perch category before 1977White surfperch (Phanerodon furcatus) 1977+.  Included in perch category before 1977Threespine stickleback (Gasterosteus auleatus), San Francisco Bay, 1976+Unspecified rays, 1928 and 1977+White sturgeon (Acipenser transmontanus) not a commercial species, 1978+Swordfish (Xiphias gladius), all years.  Also called broadbill swordfish, landings are recorded as dressed weights, multiply by 1.45 to convert to weight of whole fish.Market categories thornyhead and thornyhead rockfish (Sebastolobus spp.), may include other species, 1977+, included in rockfish before 1977.Longspine thornyhead (Sebastolobus altivelis) 1995+, in Thornyhead 1978-95, in rockfish before 1977.Shortspine thornyhead (Sebastolobus alascanus) 1995+, in Thornyhead 1978-95, in rockfish before 1977.Pacific tomcod (Microgadus proximus) many yearsTriggerfish - possibly any of these triggerfish: finescale (Balistes polylepis), black (Mellichthys niger) or redtail (Xanthicthys mento) 1980+California toungefish (Symphurus atricauda) 1982+, included in sole unspecified before 1982.Albacore tuna (Thunnus alalunga) only landings from California waters catch, all yearsBigeye tuna (Thunnus obesus) only landings from California waters catch, 1977+Tuna landed as Blackfin tuna, presumably from common name (Thunnus atlanticus) which is a Western Atlantic species, 1985-93Bluefin tuna (Thunnus thynnus) only landings from California waters catch, all yearsSkipjack tuna (Euthynnus pelamis) only landings from California waters catch, most years.Black skipjack (Euthynnus lineatus) only landings from California waters catch,1972+Yellowfin tuna (Thunnus albacares) only landings from California waters catch, most years.Any species of tuna unspecified, presumably landings from California waters catch, 1978+Diamond turbot (Hypsopsetta guttulata) 1992Hornyhead turbot (Pleuronichthys verticalis) 1995+Spotted turbot (Pleuronichthys ritteri) noneAll species of turbot before 1992, unclassified turbot after 1991Wahoo (Acanthocybium solanderi) only landings from California waters catch, 1975+Ocean whitefish (Caulolatilus princeps)  all yearsPacific whiting, also called Pacific Hake (Merluccius productus) all yearsWolf-eel (Anarrhichthys ocellatus) 1977+, included in the category eels befoe 1977.Rock wrasse (Halichoeres semicinctus) 1984+Yellowtail (Seriola dorsalis)  only landings from California waters catch, all years.Zebraperch (Hermosilla azurea) 1977+, included in perch category before 1977Unspecified trawl caught groundfish, in the 1960s, this was sold for animal food to fur breeders. Unspecified marine fish for which identification was not made or in question, and those totaling small amounts before 1980. Freshwater fish Included with hardhead until 1969, also called greaser (Orthodon microlepidotus) (Fish Bulletin 74, p47.). Freshwater catch not in database after 1971  All carp landed until 1971, some large quantities remove from Clear Lake 1931-36 (Cyprinus carpio). Freshwater catch not in database after 1971(1928-52)All freshwater catfish landed, includes Forktail or channel catfish (Ictalurus catus) and square-tail,Sacramento catfish or bullhead (Ameiurus nebulosus).  Freshwater catch not in database after 1971All freshwater fish landed as hard head (Mylopharodon conocephalus), includes SACRAMENTO BLACKFISH in most years. Freshwater catch not in database after 1971All fish landed as hitch (Lavinia exilicauda) 1967-71. Freshwater catch not in database after 1971All freshwater fish landed as pike or Sacramento squawfish (Ptychocheilus grandis) (not true pike) 1928-1951. Freshwater catch not in database after 1971All freshwater fish landed as split-tail (Pogonichtys macrolepidotus) 1928-67. Freshwater catch not in database after 1971All freshwater fish landed as Sacramento or Western sucker (Catostomus occidentalis and other species) 1928-63. Freshwater catch not in database after 1971Barnacles 1980s.  presumably goose barnaclesBox crab 1981+Claws from rock crabs  before 1991 and sheep or spider crabs (Loxorhynchus grandis), 1986+Dungeness or market crab (Cancer magister) all years, may include some rock crabs from Santa Barbara south especially in 1940sKing crab, presumably Paralithodes species, 1977+Pelagic red crabs.  1974-88, 1999Rock crabs, unspecified, all years, however some may have been recorded as market crab before 1950. Brown Rock crabs (Cancer antennarius) 1997+Red rock crabs (Cancer productus) 1996+Yellow Rock crabs (Cancer anthonyi) 1995+Sand crabs (Emerita analoga ) harvested for live bait, not in database before 1979Shore crabs  (Hemigrapsus oregonensis or Pachygrapsus crassipes) harvested for live bait, not in database before 1978Sheep or spider crabs (Loxorhynchus grandis) 1968+Crab landed as tanner crab, presumably Chionocetes species 1983+Crayfish caught in rivers and Delta (Pacifastacus leniusculus or Procambarus clarkii) 1969-71, Freshwater catch not in database after 1971California Spiny Lobster (Panulirus interruptus)  all yearsPrawns landed as Golden prawns, 1999+  Ridgeback prawn (Sicyonia ingentis) fishery first developed in 1965 Spot prawn (Pandalus platyceros) taken in the ocean 1952+. Probably Spot prawn (Pandalus platyceros) taken in the ocean at least until 1960s, then maybe mixed species. Bay Shrimp (Crago franciscorum and C. nigricauda) caught in San Francisco Bay, recorded in shrimp unspecified until 1952Brine shrimp (Artemia salina) taken in bays Coonstripe or dock shrimp (Pandanlus danae) 1986+Ghost shrimp (Callianassa californiensis) harvested for bait from bays 1978+Pacific ocean shrimp (Pandulus jordani) 1952+Red rock shrimp (Lysmata californica) for live bait fishery developed in late 1950s but not in database until 1979.Bay Shrimp (Crago franciscorum and C. nigricauda) until 1952, may be various unspecified species after.Assorted unspecifid crustaceans. 1969+,Sea cucumbers giant (Parastichopus californicus) and warty (P.parvimensis) 1978+,Unspecified echinoderms 1971-1993,Sea stars unspecified  1971+,Sea Urchin landed as lytechinus 1983+,Purple sea urchin (Strongylocentrotus purperatus) 1985+,Red sea urchin (Strongylocentrotus franciscanus) 1986+ ,See Unspecified sea urchins 1971-85Unspecified sea urchins, probably red urchins.  1971-1985\",Black abalone (Haliotis cracherodii), 1972+\",Flat abalone (Haliotis wallensis), 1972+ \",Green abalone (Haliotis fulgens), 1972+\",Pink abalone (Haliotis corrugata), 1972+\",White abalone (Haliotis sorenseni), 1972+\",Threadded abalone (Haliotis assimilis), 1972+. now believed to be a southern sub-species of pinto (H. kamtschatkana) Calif.Living Mar.Res.p89\",Pinto abalone (Haliotis kamtschatkana), 1972+\",Red abalone (Haliotis ruffescens), 1972+\",All abalone (Haliotis spp.) until 1972, all red abalone until 1950, red and pink 1950-1970, unspecified abalone after 1971. Calif.Living Mar.Res.p89Unspecified chitons 1983+.Pacific gaper clam (Tresus nuttalli) and fat gaper (T. capax). 1931+ Jackknife clam (Tagelus californianus) 1931+, used for bait F&G Fish Bulletin 74 p161Littleneck clams, cockles or chiones  (Chione fluctifraga, and C. undullata., Protothaca  staminia, and Tapes philippinarum) Pacific razor clam (Siliqua patula), sport only after 1949.Purple clam, 1983 and 1994Pismo clam (Tivela stultorum) sport only after 1947, F&G Fish Bulletin 74 p165Rosy rasor clams, 1987+Soft shelled clams (Mya arenaria) before 1950Washington clams (Saxidomus nuttalli) until 1983.Unspecified clams Limpet unspecified, 1980+Unspecified mollusks 1954+Mussels Californian (Mytilus californianus), Mediterrranean  (M. galloprovincialis), and Bay (Mytelus edulis) primarily for bait 1928-1978, Octopus unspecified (Polypus spp), all yearsCalifornia native oyster (Ostreola lurida or O. conchaphila)Eastern oyster (Crassostrea virginica) maricultured.European flat oyster, maricultured.(Crassostrea gigas and C.sikamea) maricultured 1933+Oysters unspecified  1995+Scallops unspecified specied.Sea haresSea slugSea snails unspecifiedJumbo squid (Dosididicus gigas) 1978+Market squid (Loligo opalescens) all yearsWelks, probably Kellets Welk, 1930s and 1979+Freshwater frogs 1934-35 and 1971Colonial Invertbrates, sponges and tunicatesMarine worms unspecified, 1986+Fresh or brackish water turtle (or terrapin) species 1928-1931Primarily green sea turtles, 1928";
    String fishdescr[] = new String[nFish];
    po = 0;
    for (int f = 0; f < nFish; f++) {
        fishdescr[f] = fishDescrString.substring(po, po + ndescr.get(f));

        //remove junk at start
        int start = 0;
        while ("\"., ".indexOf(fishdescr[f].charAt(start)) >= 0)
            start++;
        if (start > 0)
            fishdescr[f] = fishdescr[f].substring(start);

        //remove junk at end
        int sLen = fishdescr[f].length();
        while ("\"., ".indexOf("" + fishdescr[f].charAt(sLen - 1)) >= 0)
            sLen--;
        fishdescr[f] = fishdescr[f].substring(0, sLen) + ".";

        //other fixups
        if (fishdescr[f].startsWith("1977+ "))
            fishdescr[f] = fishdescr[f].substring(6);
        if (fishdescr[f].startsWith("(1928-41, 1995+)"))
            fishdescr[f] = fishdescr[f].substring(16);
        //if (fishdescr[f].equals("Killifish, Californ")) fishdescr[f] = "Killifish, California";
        fishdescr[f] = String2.replaceAll(fishdescr[f], "Nortern", "Northern");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "inclded", "included");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "Dolfpnin", "Dolphin");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "Monkyface", "Monkeyface");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "Soutnern", "Southern");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "   ", " "); //few
        fishdescr[f] = String2.replaceAll(fishdescr[f], "  ", " "); //many
        fishdescr[f] = String2.replaceAll(fishdescr[f], ")probably", ") probably");
        fishdescr[f] = String2.replaceAll(fishdescr[f], ",1", ", 1");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "toungefish", "tonguefish");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "tail,Sac", "tail, Sac");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "remove from", "removed from");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "analoga )", "analoga)");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "1986+ ,See ", "1986+. See ");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "(Crassostrea gigas and C.sikamea)",
                "Crassostrea gigas and C. sikamea");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "unspecified specied.", "unspecified species.");
        fishdescr[f] = String2.replaceAll(fishdescr[f], ". m", ". M");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "1980s. presumably", "1980s. Presumably");
        fishdescr[f] = String2.replaceAll(fishdescr[f], "1972+. now", "1972+. Now");
        //fishdescr[f] = String2.replaceAll(fishdescr[f], "", "");
        if (fishdescr[f].indexOf("and and") >= 0 || fishdescr[f].indexOf("primarioy") >= 0
                || fishdescr[f].indexOf("sps") >= 0) {
            String2.log("trouble: #" + f + "=" + fishdescr[f]);
        }
        String2.log(f + " " + fishdescr[f]);
        po += ndescr.get(f);
    }
    //if (true) System.exit(0);

    StringBuilder descriptions = new StringBuilder();
    for (int f = 0; f < nFish; f++)
        descriptions.append("* " + fishnames[fishOrder[f]] + " - " + fishdescr[fishOrder[f]] + "\n");
    Attributes fishAtts = (new Attributes()).add("long_name", "Fish Name").add("description",
            descriptions.toString());

    StringArray stationnames = (StringArray) PrimitiveArray.csvFactory(String.class,
            "San Diego, Los Angeles, Santa Barbara, Monterey, San Francisco, Eureka");
    Test.ensureEqual(nStations, stationnames.size(), "nStations != nStationnames");

    name = "landings";
    Attributes landingsAtts = new Attributes();
    OpendapHelper.getAttributes(das, name, landingsAtts);
    landingsAtts.set("units", "pounds");
    IntArray landings = (IntArray) OpendapHelper.getPrimitiveArray(dConnect, "?landings.landings");
    Test.ensureEqual(landings.size(), nTime_series * nStations * nFish, "landings.size");

    //make the table  0=time 1=year 2=station 3=fish 4=landings
    DoubleArray timePA = new DoubleArray();
    ShortArray yearPA = new ShortArray();
    StringArray stationPA = new StringArray();
    StringArray fishPA = new StringArray();
    IntArray landingsPA = new IntArray();
    table.addColumn(0, "time", timePA, time_seriesAtts.add("units", Calendar2.SECONDS_SINCE_1970));
    table.addColumn(1, "year", yearPA, new Attributes());
    table.addColumn(2, "fish", fishPA, fishAtts);
    table.addColumn(3, "port", stationPA, (new Attributes()).add("long_name", "Port"));
    table.addColumn(4, "landings", landingsPA, landingsAtts);

    //add the data
    double tbf[] = Calendar2.getTimeBaseAndFactor("hours since 1900-01-01T00:00:00Z");

    for (int t = 0; t < nTime_series; t++) {
        double tt = time_series.get(t);
        double epSec = Calendar2.unitsSinceToEpochSeconds(tbf[0], tbf[1], tt);
        int tYear = String2.parseInt(Calendar2.epochSecondsToIsoStringT(epSec).substring(0, 4));

        int landingsAll[] = new int[nFish]; //0's
        for (int s = 0; s < nStations; s++) {
            int base = t * nStations * nFish + s * nFish;

            for (int f = 0; f < nFish; f++) {
                timePA.add(epSec);
                yearPA.addInt(tYear);
                fishPA.add(fishnames[f]);
                stationPA.add(stationnames.get(s));
                int tLandings = landings.get(base + f);
                landingsPA.add(tLandings);
                if (tLandings > 0)
                    landingsAll[f] += tLandings; // >0 handles mv
            }

        }

        //add the data for the All Station
        for (int f = 0; f < nFish; f++) {
            timePA.add(epSec);
            yearPA.addInt(tYear);
            fishPA.add(fishnames[f]);
            stationPA.add("All");
            landingsPA.add(landingsAll[f]);
        }
    }
    stationnames.add("All");
    nStations++;

    //sort by fish,port,time
    table.sort(new int[] { 2, 3, 0 }, new boolean[] { true, true, true });

    //save in baseDir/station/fish.nc
    String monthlyDir = "C:/u00/data/points/erdCAMarCatLM/";
    String yearlyDir = "C:/u00/data/points/erdCAMarCatLY/";
    File2.deleteAllFiles(monthlyDir, true, true); //recursive, deleteEmptySubdirectories
    File2.deleteAllFiles(yearlyDir, true, true); //recursive, deleteEmptySubdirectories
    int nRows = table.nRows();
    for (int s = 0; s < nStations; s++) {
        //make subdirectory
        String tStation = stationnames.get(s);
        String tMonthlyDir = monthlyDir + String2.encodeFileNameSafe(tStation) + "/";
        String tYearlyDir = yearlyDir + String2.encodeFileNameSafe(tStation) + "/";
        File2.makeDirectory(tMonthlyDir);
        File2.makeDirectory(tYearlyDir);
        for (int f = 0; f < nFish; f++) {
            String tFish = fishnames[f];
            String2.log(tStation + " " + tFish);
            BitSet bitset = new BitSet(nRows);
            for (int row = 0; row < nRows; row++)
                bitset.set(row, fishPA.get(row).equals(tFish) && stationPA.get(row).equals(tStation));

            //* make the monthly table  0=time 1=year 2=station 3=fish 4=landings
            DoubleArray tTimePA = (DoubleArray) timePA.clone();
            tTimePA.justKeep(bitset);
            ShortArray tYearPA = (ShortArray) yearPA.clone();
            tYearPA.justKeep(bitset);
            StringArray tStationPA = (StringArray) stationPA.clone();
            tStationPA.justKeep(bitset);
            StringArray tFishPA = (StringArray) fishPA.clone();
            tFishPA.justKeep(bitset);
            IntArray tLandingsPA = (IntArray) landingsPA.clone();
            tLandingsPA.justKeep(bitset);
            Table tTable = new Table();
            tTable.addColumn(0, "time", tTimePA, (Attributes) table.columnAttributes(0).clone());
            tTable.addColumn(1, "year", tYearPA, (Attributes) table.columnAttributes(1).clone());
            tTable.addColumn(2, "fish", tFishPA, (Attributes) table.columnAttributes(2).clone());
            tTable.addColumn(3, "port", tStationPA, (Attributes) table.columnAttributes(3).clone());
            tTable.addColumn(4, "landings", tLandingsPA, (Attributes) table.columnAttributes(4).clone());

            //save the monthly file
            tTable.saveAsFlatNc(tMonthlyDir + String2.encodeFileNameSafe(tFish) + ".nc", "row", false);

            //* condense to yearly data
            int readRow = 0, writeRow = 0, tnRows = tTable.nRows();
            while (readRow < tnRows) {
                short tYear = tYearPA.get(readRow);
                int sum = tLandingsPA.get(readRow);
                int nextRow = readRow + 1;
                while (nextRow < nRows && tYear == yearPA.get(nextRow)) {
                    sum += tLandingsPA.get(nextRow);
                    nextRow++;
                }
                //store the data on writeRow;  change time to be tYear-07-01
                tTimePA.set(writeRow, Calendar2.isoStringToEpochSeconds(tYear + "-07-01"));
                tYearPA.set(writeRow, tYear);
                tStationPA.set(writeRow, tStation);
                tFishPA.set(writeRow, tFish);
                tLandingsPA.set(writeRow, sum);
                writeRow++;

                readRow = nextRow;
            }
            tTable.removeRows(writeRow, tnRows);

            //save the yearly file
            tTable.saveAsFlatNc(tYearlyDir + String2.encodeFileNameSafe(tFish) + ".nc", "row", false);
        }
    }

    String2.log("\n*** Projects.getCAMarCatLong successfully created");
}